package cn.samir.sudoku.ui;

import android.app.FragmentManager;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Switch;
import android.widget.TextView;
import cn.samir.sudoku.R;
import cn.samir.sudoku.fragment.SettingsFragment;

//按编号排名还是按难度排名
//
public class SettingsActivity extends BaseActivity implements OnClickListener {

	SettingsActivity mContext = this;
	Switch openHelpSwitch;
	TextView tv_detail;
	TextView tv_scoreInfo;
	FragmentManager fragmentManager;
	SettingsFragment settingsFragment;
	boolean isExpanned = false;
	Handler handler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			switch (msg.what) {
			case 1:

				break;

			default:
				break;
			}
		};
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_settings);
		initViews();
		settingsFragment = new SettingsFragment();
		getFragmentManager().beginTransaction()
				.replace(R.id.container, settingsFragment).commit();
	}

	private void initViews() {
		tv_detail = getView(R.id.tv_detail);
		tv_detail.setOnClickListener(this);
		tv_scoreInfo= getView(R.id.tv_scorerules);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_detail:
			isExpanned = !isExpanned;
			if(isExpanned){
				tv_scoreInfo.setMaxLines(100);
				tv_detail.setText("收起");
			}else{
				tv_scoreInfo.setMaxLines(2);
				tv_detail.setText("详细");
			}
			
			break;

		default:
			break;
		}
	}

}
